package com.woniuxy.commons.interceptor.configuration;

import com.woniuxy.commons.interceptor.PermissionIntercptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @author: 15489  <br/>
 * Date: 2022/3/30:15:14  <br/>
 * Description:  拦截器配置类 将拦截器添加到拦截器列表中 同时指定拦截那些请求
 */

@Configuration
public class PermissionInterceptorConfiguration implements WebMvcConfigurer {
    @Resource
    private PermissionIntercptor permissionIntercptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
//        添加拦截器并拦截使用请求
       registry.addInterceptor(permissionIntercptor).addPathPatterns("/**");
    }
}
